package com.tour.controller;


import com.tour.config.ResponseWrapper;
import com.tour.entity.Picture;
import com.tour.service.impl.PictureServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lel
 * @since 2021-04-26
 */
@RestController
@Api(tags = "广告位图片")
@RequestMapping("/app/picture")
public class PictureController {


    @Autowired
    PictureServiceImpl pictureService;

    @ApiOperation("增加广告位图片")
    @PostMapping("/addPic")
    public ResponseWrapper addPic(@RequestBody Picture picture){
        ResponseWrapper wrapper = pictureService.addPic(picture);
        return wrapper;
    }

    @ApiOperation("删除广告位图片")
    @DeleteMapping("/deletePic")
    public ResponseWrapper deletePic(@RequestParam(name = "pid") Integer pid){
        ResponseWrapper wrapper = pictureService.deletePic(pid);
        return wrapper;
    }

    @ApiOperation("修改广告位图片")
    @PutMapping("/updatePic")
    public ResponseWrapper updatePic(@RequestBody Picture picture){
        ResponseWrapper wrapper = pictureService.updatePic(picture);
        return wrapper;
    }

    @ApiOperation("查看广告位图片")
    @GetMapping("/findaAllPic")
    public ResponseWrapper findaAllPic(){
        ResponseWrapper wrapper = pictureService.findaAllPic();
        return wrapper;
    }
}

